<!doctype html>
<!--
Copyright 2014 Google Inc. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <meta name="description" content="Sample illustrating the use of the picture element.">

    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>&lt;picture&gt; Element Sample</title>

    <!-- Add to homescreen for Chrome on Android -->
    <meta name="mobile-web-app-capable" content="yes">
    <link rel="icon" sizes="192x192" href="../images/touch/chrome-touch-icon-192x192.png">

    <!-- Add to homescreen for Safari on iOS -->
    <meta name="apple-mobile-web-app-title" content="Picture Element Sample">

    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" href="../images/apple-touch-icon-precomposed.png">

    <!-- Tile icon for Win8 (144x144 + tile color) -->
    <meta name="msapplication-TileImage" content="images/touch/ms-touch-icon-144x144-precomposed.png">
    <meta name="msapplication-TileColor" content="#3372DF">

    <link rel="icon" href="../images/favicon.ico">

    <link rel="stylesheet" href="../styles/main.css">
  </head>

  <body>
    <h1>&lt;picture&gt; Element Sample</h1>
    <p>Available in <a href="https://www.chromestatus.com/feature/5910974510923776">Chrome 38+</a></p>

    <p>The <code>&lt;picture></code> element informs Chrome which version of
    an image resource to fetch based on some criteria, such as the browser
    viewport size and/or image format support.</p>

    <section id="media-query-example">

      <p>In the first example below, resize the browser to see different versions
      of the picture loading at different viewport sizes. The browser looks for
      the first <code>&lt;source></code> element where the media query matches
      the user's current viewport width, and fetches the image specified in the
      <code>srcset</code> attribute of that <code>&lt;source></code> element.</p>

      <!-- // [START code-block-source-media] -->
      <style>
        picture {display: block; width: 100%; text-align: center;}
      </style>

      <picture>
        <source media="(min-width: 650px)" srcset="images/kitten-large.png">
        <source media="(min-width: 465px)" srcset="images/kitten-medium.png">
        <!-- img tag for browsers that do not support picture element -->
        <img src="images/kitten-small.png" alt="a cute kitten">
      </picture>
      <!-- // [END code-block] -->

    </section>

    <section id="file-format-example">

      <p>In the second example below, the browser will display a WebP image
      instead of a JPG when the browser supports WebP.</p>

      <!-- // [START code-block-source-type] -->
      <picture>
        <source type="image/webp" srcset="images/butterfly.webp">
        <img src="images/butterfly.jpg" alt="a butterfly">
      </picture>
      <!-- // [END code-block] -->

    </section>

    <section id="notes">

      <p>The <code>&lt;img></code> element is required as the last nested child
      tag of the <code>&lt;picture></code> declaration block. The
      <code>&lt;img></code> element will act as the default image resource and
      also the fallback for browsers that do not support the
      <code>&lt;picture></code> element.</p>

    </section>

    <script>
      /* jshint ignore:start */
      (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
      m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
      })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
      ga('create', 'UA-53563471-1', 'auto');
      ga('send', 'pageview');
      /* jshint ignore:end */
    </script>
    <!-- Built with love using Web Starter Kit -->
  </body>
</html>
